home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
comm
/
uwpc201.zip
/
TERMCC.DOC
< prev
next >
Wrap
Text File
|
1991-11-15
|
19KB
|
420 lines
Termcap Compiler Version 1.01
Copyright (C) 1991 Rhys Weatherley
1. INTRODUCTION
The Termcap Compiler is a tool for creating new terminal emulations for use
with UW/PC (versions 2.00 and higher). It takes source code in the form of an
abstract assembly code and compiles them into binary terminal descriptions that
UW/PC can use to provide new types of terminal emulations. The standard UW/PC
terminal types are included as examples of the assembly code versions of the
terminal descriptions in the files VT52.CAP, ADM31.CAP and ANSI.CAP in the
source code archive UW-SRC.ZIP.
2. USING THE TERMCAP COMPILER.
The Termcap Compiler "TERMCC" accepts assembly code from the filename supplied
as an argument and writes the resultant compiled terminal description to the
supplied output file or a file with the same path and name as the input file,
but with a ".TRM" extension. The full command syntax is:
TERMCC infile[.CAP] [outfile[.TRM]]
3. USING NEW TERMINAL DESCRIPTIONS WITH UW/PC.
This section explains how you can add terminal descriptions you have written
and compiled to UW/PC so that it will use them during communications. This
is also explained in "UW.DOC", but is repeated here for convenience.
In the configuration file "UW.CFG" for UW/PC the following configuration
options can be specified:
emul (default adm31)
The default terminal emulation type to use for windows.
When a new window is created, it will use this emulation
type. This can be one of adm31, vt52, or ANSI or a string
(e.g. "vt102"), signifying a currently loaded terminal
description that will be searched for to become the
default emulation. The double quotes are optional.
When the terminal description is searched for, case is
ignored during compares.
emul0 (defaults to whatever emul is set to)
Set the terminal emulation type for protocol 0. This is
to rectify some problems with UNIX termcap entries that
are missing the entry for ADM31 terminals, as discussed
above under "USING UW/PC". It can be one of adm31, vt52
or ansi or a string specifying a terminal type loaded
with the "terminal" configuration option.
terminal (no default)
This can appear up to five times in the configuration file
and each occurrence will load a terminal description into
memory. It's string value specifies a filename for a
compiled terminal description. The full pathname should be
supplied. For example, the following line could be added to
the configuration file to add a "VT102" terminal emulation:
terminal="c:\uw\vt102.trm"
The standard VT52, ADM31 and ANSI terminal types can be
replaced with new terminal descriptions by loading new
files that have the VT52, ADM31 or ANSI terminal type
specified.
4. THE ABSTRACT MACHINE.
UW/PC uses a small interpretive abstract machine to decode compiled terminal
descriptions on the fly while performing communications. Its overhead is
small enough not to have a significant impact on the performance of UW/PC.
This abstract machine has a number of registers that can be accessed from
the assembly code described in the next section.
accumulator - This is the primary control register. It holds
16 bit signed values.
x register - This is an auxillary register, primarily used for
cursor positioning during terminal emulation. It
holds 16 bit signed values.
y register - This is an auxillary register, primarily used for
cursor positioning during terminal emulation. It
holds 16 bit signed values.
comparator - After a comparison instruction, this register will
hold a value that is inspected during the conditional
jump instructions. Its (16 bit) value cannot be
directly accessed.
flags - This is a 16 bit quantity that allows you to record
up to 16 single bit flags that may be useful for
recording such information as whether the terminal's
insertion mode is on or off, etc.
saved x reg - An auxillary register that can be used to save the
terminal's current X cursor co-ordinate. It's value
cannot be directly accessed, except through the
"savexy", "restxy" and "getxy" instructions.
saved y reg - An auxillary register that can be used to save the
terminal's current Y cursor co-ordinate. It's value
cannot be directly accessed, except through the
"savexy", "restxy" and "getxy" instructions.
saved attribute - An auxillary register that can be used to save the
terminal's current printing attribute. It's value
cannot be directly accessed, except through the
"saveattr" and "restattr" instructions.
argument array - An array of eight 16-bit quantities that can be used
to store arguments to escape sequences for emulations
such as ANSI and VT102 which have variable numbers of
arguments for their escape sequences.
number of args - A 16-bit quantity that normally records how many
arguments are in the argument array. It can also
be used as a loop counter.
5. ASSEMBLY INSTRUCTIONS.
This section describes the format of the assembly source file, and the various
instructions that can be used to create terminal descriptions.
The source file can contain comments that begin with "//" and continue to the
end of the line (like in C++), and it must begin with a "name" instruction,
although this is not checked by the compiler. There is no fixed format for
the instructions except that labels cannot occur between an instruction's
name and its arguments. Other than that, an instruction can appear in any
way with any amount of white space and comments surrounding its name and
arguments, and any number of instructions and labels can appear on the one
line or wrapped across lines. Despite this, it is better to only place one
instruction on each line with an optional label preceding it, as shown in the
example terminal descriptions.
Labels consist of an alphanumeric identifier (that must not be an instruction
name) and a colon. The two labels "start" and "keys" must be present in the
source file. "start" indicates where the decoding for output to the terminal
screen begins, and "keys" indicates where the decoding of special keycodes
(for example terminal function keys) begins. Without these labels, UW/PC
cannot process the terminal description properly.
There is one special escape sequence that EVERY terminal type MUST support:
"ESC |". This will be used by UW/PC together with some of the upcoming
enhancements to UW/PC. The handling for this escape sequence is to use
"getch" to retrieve the next character after the '|' and then to execute the
"client" instruction. If a terminal description does not handle this escape
sequence in this way, then the special clients cannot be activated in
windows of that terminal type.
add - Adds the instruction's argument to the accumulator.
The argument can be numeric, "width" or "height".
bell - Ring the terminal bell.
bs - Move the cursor back one character. The cursor will
not wrap around to the previous line if it is at the
start of the current line.
bswrap - Move the cursor back one character and wrap around to
the end of the previous line if necessary. If the cursor
is in the top-left screen position, it won't be moved.
clear - Clear the entire screen to the current scrolling attribute.
The cursor is not moved from its current position.
client - This should be executed for the escape sequence ESC '|'.
UW/PC uses this for some of its specialised clients such
as the upcoming mail tool uwmail.
clreol - Clear to the end of the current line in the current
scrolling attribute.
clreos - Clear to the end of the screen from the current cursor
position in the current scrolling attribute.
clrsol - Clear to the start of the current line in the current
scrolling attribute. The current cursor position is
not cleared.
clrsos - Clear to the start of the screen from the current
cursor position in